from abc import ABC, abstractmethod
from flask import Flask
from typing import Dict, Any
from utils.logger import Logger

class BaseModule(ABC):
    """Base class for all feature modules"""
    
    def __init__(self, app: Flask, logger: Logger, config: Dict[str, Any]):
        """Initialize the base module
        
        Args:
            app: Flask application instance
            logger: Logger instance
            work_dir: Work directory path
            config: Module configuration from server_config.yaml
        """
        self.app = app
        self.logger = logger
        self.config = config
        
        # Initialize the module
        self.init_module()
        
        # Register routes
        self.register_routes()
        
    @abstractmethod
    def init_module(self):
        """Initialize module-specific resources"""
        pass
        
    @abstractmethod
    def register_routes(self):
        """Register module-specific routes"""
        pass
        
    @abstractmethod
    def cleanup(self):
        """Cleanup module resources"""
        pass 